var AlumniCommandService = RestfulService.extend({
	SERVICE_URL : 'api/alumni',
	createPeronsalInformation : function(info ,successcb, errorcb){
		this._post(this.SERVICE_URL, info, successcb, errorcb);
	} ,
	addWorks : function(alumusId , works , successcb, errorcb) {
		this._post(this.SERVICE_URL + "/" + alumusId + '/add/workexperiences', works, successcb, errorcb);
	} , 
	addActivities : function(alumusId , activities ,successcb, errorcb){
		this._post(this.SERVICE_URL + "/" + alumusId + '/add/activities', activities, successcb, errorcb);
	} ,
	addEducations : function(alumusId , educations ,successcb, errorcb){
		this._post(this.SERVICE_URL + "/" + alumusId + '/add/educations', educations, successcb, errorcb);
	} ,
	addDonations : function(alumusId , donations , successcb, errorcb) {
		this._post(this.SERVICE_URL + "/" + alumusId + '/add/donations', donations, successcb, errorcb);
	} , 
	assignAssociation : function(alumusId , association ,successcb, errorcb){
		this._post(this.SERVICE_URL + "/" + alumusId + '/assign/association', association, successcb, errorcb);
	} ,
	addAvatar : function(alumusId , file ,successcb, errorcb){
		var fd = new FormData();
        fd.append("file", file);
        var promise =  this.$http.post(this.SERVICE_URL+ '/' + alumusId + '/add/avatar', fd, {
            withCredentials: true,
            headers: {'Content-Type': undefined },
            transformRequest: angular.identity
         });
        return this._thenFactoryMethod(promise, successcb, errorcb);
	}
});

(function() {

	var AlumniCommandServiceProvider = Class.extend({
		instance : new AlumniCommandService(),
		$get : [ '$http', function($http) {
			this.instance.$http = $http;
			return this.instance;
		} ]
	})
	angular.module('alumni.AlumniCommandService', []).provider('AlumniCommandService', AlumniCommandServiceProvider);
}());